<template>
	<view class="main">
		<uni-list>
			<uni-list-item :title="$t('mine.feedback')" thumb="../../static/image/feedback.png" thumb-size="medium"
				showArrow to="/pages/feedback/feedback" />
			<uni-list-item :title="$t('mine.about')" thumb="../../static/image/about.png" thumb-size="medium" showArrow
				to="/pages/about/about" />
			<uni-list-item :title="$t('mine.update')" thumb="../../static/image/update.png" thumb-size="medium"
				showArrow to="/pages/version/version" />
		</uni-list>

		<view class="btn" @click="logout">
			{{$t("login.logout")}}
		</view>
		<uni-popup ref="popup" type="dialog">
			<uni-popup-dialog type="info" :title="$t('mine.logout')" :confirmText="$t('login.confirm')"
				:cancelText="$t('search.cancel')" :duration="2000" :before-close="true" @close="close"
				@confirm="confirm"></uni-popup-dialog>
		</uni-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {

			}
		},
		methods: {
			logout() {
				this.$refs.popup.open()
			},
			close() {
				this.$refs.popup.close()
			},
			confirm() {
				this.$httpRequest({
					url: "app/api/loginout.php",
					method: "POST"
				}).then(res => {
					if (res.errorcode) {
						this.$refs.popup.close()
						uni.removeStorageSync("token")
						uni.removeStorageSync('lists');
						uni.reLaunch({
							url: "/pages/login/login"
						})
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.main {
		.btn {
			width: 90%;
			margin: 64rpx auto;
			height: 88rpx;
			border-radius: 8rpx;
			border: 2rpx solid #D8D8D8;
			font-size: 32rpx;
			font-family: PingFang SC-Medium, PingFang SC;
			font-weight: 500;
			color: #999999;
			text-align: center;
			line-height: 88rpx;
		}
	}
</style>
